package com.rs.game.player.dialogues;

/**
 * Switching prayer and magic dialogue handler.
 * 
 * @author Swirl
 * 
 */
public class Switching extends Dialogue {

	@Override
	public void start() {
		sendOptionsDialogue("Select an Option", "Switch Magic", "Switch Prayer");
		stage = 1;
	}

	@Override
	public void run(int interfaceId, int componentId) {
		switch (stage) {
		case 0:
			sendOptionsDialogue("Select an Option", "Switch Magic", "Switch Prayer");
			stage = 1;
			break;
		case 1:
			switch (componentId) {
			case OPTION_1:
				if (player.getCombatDefinitions().getSpellBook() == 192) {
					player.getCombatDefinitions().setSpellBook(1);
					sendDialogue("You are now using the Ancient spellbook.");
					stage = 0;
					break;
				}
				if (player.getCombatDefinitions().getSpellBook() == 193) {
					player.getCombatDefinitions().setSpellBook(2);
					sendDialogue("You are now using the Lunar spellbook.");
					stage = 0;
					break;
				}
				if (player.getCombatDefinitions().getSpellBook() == 430) {
					player.getCombatDefinitions().setSpellBook(0);
					sendDialogue("You are now using the Modern spellbook.");
					stage = 0;
					break;
				}
				break;
			case OPTION_2:
				if (player.getPrayer().isAncientCurses()) {
					player.getPrayer().setPrayerBook(false);
					sendDialogue("You are now using the normal prayer book.");
				} else {
					player.getPrayer().setPrayerBook(true);
					sendDialogue("You are now using curses.");
				}
				stage = 0;
				break;
			}
		}
	}

	@Override
	public void finish() {

	}

}
